package game
{
    import flash.utils.getTimer;

    public class GameTimer
    {
        //-----------------------------
        //  Timing
        //-----------------------------
        public static var lastTime : int = 0;
        
        public static function update() : Number
        {
            if (lastTime == 0)
            {
                lastTime = getTimer();
            }
            
            var now : int = getTimer();
            var elapsed : Number =  now - lastTime;
            
            elapsed = elapsed / 1000;
            
            if (elapsed > 0.2)
            {
                elapsed = 0.2;
            }
            else if (elapsed < 0)
            {
                elapsed = 0;
            }
            
            lastTime = now;
            
            return elapsed;
        }
    }
}